<?php

defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE.'/'.$module.'/common.inc.php';
require DT_CORE.'/buyhelp/common.inc.php';
$navname ='guide';
$order= 'addtime desc';
//status=3表明审核状态
$condition="status=3";

//接收cookie中处理后传回的值并和车型库关联
if($cartypeid == 1) $filter['ctp'] =433;
if($cartypeid == 2 ) $filter['ctp'] =434;
if($cartypeid == 3 ) $filter['ctp'] =435;
if($cartypeid == 4) $filter['cen'] =432;

require_once DT_INC . '/search/listAuto.inc.php';

if ($autoFilter) {

    $carids   = $carids ? $carids : array('-');
    $brandids = $brandids ? $brandids : array('-');
    //车型
    $condition .= " and arcid in (" . Sql::in($carids) . ")";
//品牌
   $condition .= " and arbid in (" . Sql::in($brandids) . ")";
}


//接收传回的参数并赋给$condition作为查询的条件
if (!empty($CAT)) {
    $condition .= "and catid={$catid}";

}

if($cityid) {
	$condition .=  " AND (city like '%|".$cityid."|%' or city like '%|0|%') ";
}
//搜索
if($kw){
    $condition .= " AND title LIKE '%$kw%'";
}
//列表页上方显示
$catname = $CAT['catname'] ? $CAT['catname'] : '综合导购';
//查询条数
$items = $db->count($table, $condition);
//初始化分页类
/*
$pn = new Pagination();
$pagesize = 60;

//将每页显示的页数和总条数传给分页类
$pn->recordsPerPage($pagesize);
$pn->records($items);

//$list = $db->getAll("select $fields from {$db->getPre()}guide where status=3 and $condition order by {$order} limit " . ($pn->getPage() - 1) * $pagesize . ',' . $pagesize);
$sql = "select title,thumb,itemid,addtime from {$db->getPre()}guide where status=3 and $condition   order by {$order} limit ". ($pn->getPage() - 1) * $pagesize . ',' . $pagesize;

$list= $db->getAll($sql);
*/
// 模块的分页数

$do = new GuideModule($moduleid);

$tags = array();
$pagesize=60;

$do->setPagesize($pagesize);



if($items) {
    $tags = $do->getList($condition);
}

$seo_file = 'index';
include DT_INC.'/seo.inc.php';
include template('list', $module);